package reflect;
public class ReflectGetClass {
    public static void main(String[] args) throws ClassNotFoundException {
        //方式一：Class.forName("全类名")
        Class aClass = Class.forName("reflect.Person");
        System.out.println(aClass);
        //2. 类名.class：通过类名的属性class获取
        Class aClass1 = Person.class;
        System.out.println(aClass1);
        //3. 对象.getClass()：getClass()方法在Object类中定义着。
        Person person=new Person();
        Class aClass2 = person.getClass();
        System.out.println(aClass2);
        //比较三个对象
        System.out.println(aClass==aClass1);//true
        System.out.println(aClass==aClass2);//true
        System.out.println(aClass1==aClass2);//true

    }
}